home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / dvtools / examples / windows / mfc_mdi / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-08  |  2.5 KB  |  108 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mfc_mdi.h"
  6. #include "MainFrm.h"
  7.  
  8. // Standard DataViews header:
  9. #include "Tfundecl.h"    // T routines (screens, drawports & views)
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CMainFrame
  19.  
  20. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  21.  
  22. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  23.     //{{AFX_MSG_MAP(CMainFrame)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code !
  26.     ON_WM_CREATE()
  27.     //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29.  
  30. static UINT indicators[] =
  31. {
  32.     ID_SEPARATOR,           // status line indicator
  33.     ID_INDICATOR_CAPS,
  34.     ID_INDICATOR_NUM,
  35.     ID_INDICATOR_SCRL,
  36. };
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CMainFrame construction/destruction
  40.  
  41. CMainFrame::CMainFrame()
  42. {
  43. }
  44.  
  45. CMainFrame::~CMainFrame()
  46. {
  47. }
  48.  
  49. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  50. {
  51.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  52.         return -1;
  53.     
  54.     if (!m_wndToolBar.Create(this) ||
  55.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  56.     {
  57.         TRACE0("Failed to create toolbar\n");
  58.         return -1;      // fail to create
  59.     }
  60.  
  61.     if (!m_wndStatusBar.Create(this) ||
  62.         !m_wndStatusBar.SetIndicators(indicators,
  63.           sizeof(indicators)/sizeof(UINT)))
  64.     {
  65.         TRACE0("Failed to create status bar\n");
  66.         return -1;      // fail to create
  67.     }
  68.  
  69.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  70.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  71.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  72.  
  73.     // TODO: Delete these three lines if you don't want the toolbar to
  74.     //  be dockable
  75.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  76.     EnableDocking(CBRS_ALIGN_ANY);
  77.     DockControlBar(&m_wndToolBar);
  78.  
  79.     return 0;
  80. }
  81.  
  82. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  83. {
  84.     // TODO: Modify the Window class or styles here by modifying
  85.     //  the CREATESTRUCT cs
  86.  
  87.     return CMDIFrameWnd::PreCreateWindow(cs);
  88. }
  89.  
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CMainFrame diagnostics
  92.  
  93. #ifdef _DEBUG
  94. void CMainFrame::AssertValid() const
  95. {
  96.     CMDIFrameWnd::AssertValid();
  97. }
  98.  
  99. void CMainFrame::Dump(CDumpContext& dc) const
  100. {
  101.     CMDIFrameWnd::Dump(dc);
  102. }
  103.  
  104. #endif //_DEBUG
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CMainFrame message handlers
  108.